﻿using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Security.Permissions;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Traceability.Commont.Domains;
using Traceability.Commont.DTOs.UsersFile;

namespace Butcher.winform.EnterpriseForms.RBAC
{
    public partial class RoleList : Form
    {
        public RoleList()
        {
            InitializeComponent();
        }
        public class rolenes
        {
            public string? RolesName { get; set; }
            public DateTime dateTime { get; set; } = DateTime.Now;
            public string perList { get; set; }
            public int Pid { get; set; } = 0;
            public int rolesId { get; set; }
        }
        rolenes rolees = new rolenes();

        public string PermissionsName = "";

        private void RoleList_Load(object sender, EventArgs e)
        {

            Permissions permissions = new Permissions();
            Roles Roles = new Roles();
            rolees.RolesName = Roles.RolesName;

            string url = @"http://localhost:5021/api/Trace/GetRoles?rolesName=" + Roles.RolesName;
            HttpClient client = new HttpClient();
            string result = client.GetStringAsync(url).Result;
            JObject info = JObject.Parse(result);
            var aaa = info["date"].Value<JArray>();
            List<RolesListDTO> cts = aaa.ToObject<List<RolesListDTO>>();


            dataGridView1.DataSource = cts;

        }

        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

        }
    }
}
